Director Article

3D User Interfaces and 3D App Building Using the Chrome Library Set of Behaviors


Table of Contents

  1. Introduction
  2. Setting Up the Texture Render Format
  3. Setting Up Hardware Anti-Aliasing (FSAA)
  4. Setting Up the Shader Blend Level for Reflection
  5. Opening and Closing the Movable Parts of the Car
  6. Creating a UI on Top of the 3D Scene
  7. Changing the Camera
  8. Creating a 3D Navigation System for a Website
  9. Controlling Flash from Shockwave 3D
  10. Afterword and Conclusion

Creating a UI on Top of the 3D Scene

You will use the booth screen to display photographs of Paris and London to create ambiance for the booth. If you have ever been to a motor show, you know car makers always try to create ambiance for their booths. You want the user to be able to switch between photographs by clicking overlay buttons.

Import the nine bitmap cast members for full-size pictures and nine smaller ones for thumbnails. These should be imported into the internal cast and are included in the sample files download linked at the beginning of this article.

The 3D graphic artist created a shader called Booth Screen in the scene so you can display pictures onto the screen. It has an emissive color already set to white (RGB 255, 255, 255) in 3DS Max, so it looks realistic when you display pictures or videos on it.

For each photo button, you will apply two behaviors, the Environmental Mapping and Overlay Button UI behaviors, as shown below.

The Environment Mapping behavior

Figure 13a. The Environment Mapping behavior

The Overlay Button UI behavior

Figure 13b. The Overlay Button UI behavior

  1. Drag and drop the Environment Mapping behavior from the Chrome Library onto the W3D sprite, either on the Stage or in the Score. The following dialog box appears:

    The Environment Mapping Parameters dialog box

    Figure 14. The Environment Mapping Parameters dialog box

  2. Select Booth Screen as the shader to affect
  3. .
  4. Uncheck Affect all shaders.
  5. Select the Booth Screen model.
  6. Select the full-size picture you want to display on the booth screen for the bitmap parameter.
  7. Select texture as Mapping type.
  8. Click OK.
  9. Drag and drop the Overlay Button UI behavior from the Chrome Lib onto the W3D sprite, either on the Stage or in the Score. The following dialog box appears:

    The Overlay Button UI parameters dialog box

    Figure 15. The Overlay Button UI parameters dialog box

  10. Enter the relevant X and Y coordinates in pixels for the button position on top of the 3D scene. For instance, you want to have the buttons displayed at the bottom left corner of the scene.
  11. As you do not have several different bitmaps for the normal, pressed, rollover, and selected states, select the same thumbnail bitmap for all four states. This is mandatory. The thumbnail bitmap must match the full-sized image you selected in the first behavior.
  12. Uncheck Button Group as you do not want a radio button behavior and you are not creating a navigation interface, only click buttons.
  13. Select the W3D Sprite number (that is, the number of the sprite channel displaying the W3D cast member).
  14. Enter the Behavior number of the previously created behavior (the Environment Mapping behavior). You need this to tell Director what behavior this button will control. You can find a behavior number by looking at the behavior list in the Behavior tab of the Property inspector.
  15. Enter beginSprite() as the Handler call.
  16. Click OK.

Repeat these two steps for the nine photos.

Here is the behavior list of the W3D sprite in the Behavior inspector. As you can see, there are now quite a few behaviors assigned to the W3D sprite:

The Behavior inspector

Figure 16. The Behavior inspector

Click the Play button in the Control panel or press Enter to start the movie. The nine buttons appear at the bottom left corner on top of the 3D scene. By default, the first photo displayed on the screen is the one pointed to by the last assigned Environment Mapping behavior. Click any button, and the corresponding picture will display on the booth screen in the background.

The car with the 9 overlay buttons displayed

Figure 17. The car with the nine overlay buttons displayed

If you would like to have no picture displayed when the movie starts, use a blank bitmap as the thumbnail and a full-size image for the last button. This way, the first picture displayed on the booth screen will be blank (that is, white, beige, gray, or black). Also, when the user wants to disable picture viewing, he/she will be able to click the last button to reset the display. The nobackground.gif image is included in the sample files in the bitmaps/pictures folder (together with the nine photos) so you can experiment with this idea.